﻿namespace MyTRCP.Common.Codecs.Sbc
{
    public class SbcEncoderState
    {
        public int Position { get; set; }
        public byte Increment { get; set; }
        public short[,] X { get; set; } = new short[2, SbcCommon.SBC_X_BUFFER_SIZE];
        public delegate void SbcAnalyze(short[,] x, int xCh, int xPos, int[,,] @out, int outBlk, int outCh);
        public delegate int SbcEncProcessInputXsXe(int position, byte[] pcm, int pcmPos, short[,] X, int nsamples, int nchannels);
        public SbcAnalyze SbcAnalyze4s { get; set; }
        public SbcAnalyze SbcAnalyze8s { get; set; }
        public SbcEncProcessInputXsXe SbcEncProcessInput4sLe { get; set; }
        public SbcEncProcessInputXsXe SbcEncProcessInput4sBe { get; set; }
        public SbcEncProcessInputXsXe SbcEncProcessInput8sLe { get; set; }
        public SbcEncProcessInputXsXe SbcEncProcessInput8sBe { get; set; }
        public delegate void SbcCalcSF(int[,,] sb_sample_f, uint[,] scale_factor, int blocks, int channels, int subbands);
        public delegate int SbcCalcSFJ(int[,,] sb_sample_f, uint[,] scale_factor, int blocks, int subbands);
        public SbcCalcSF SbcCalcScalefactors { get; set; }
        public SbcCalcSFJ SbcCalcScalefactorsJ { get; set; }
        public string ImplementationInfo { get; set; }
        public SbcEncoderState()
        {
            SbcAnalyze4s = SbcCommon.SbcAnalyze4b4sSimd;
            SbcAnalyze8s = SbcCommon.SbcAnalyze4b8sSimd;
            SbcEncProcessInput4sLe = SbcCommon.SbcEncProcessInputS4Le;
            SbcEncProcessInput4sBe = SbcCommon.SbcEncProcessInputS4Be;
            SbcEncProcessInput8sLe = SbcCommon.SbcEncProcessInputS8Le;
            SbcEncProcessInput8sBe = SbcCommon.SbcEncProcessInputS8Be;
            SbcCalcScalefactors = SbcCommon.SbcCalcScaleFactors;
            SbcCalcScalefactorsJ = SbcCommon.SbcCalcScaleFactorsJ;
            ImplementationInfo = ".net";
        }
    }
}
